package com.cnseedlingscloud.draw.prize.dao;


import com.cnseedlingscloud.draw.prize.entity.TurntablePhone;
import com.cnseedlingscloud.draw.prize.entity.TurntableRecord;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface TurntablePhoneDao {

    @Results(id = "turntablePhoneMap", value = {
            @Result(property = "id", column = "id", id = true),
            @Result(property = "phone", column = "phone")
    })
    @Insert("insert into turntable_phone(phone) values(#{phone})")
    @Options(useGeneratedKeys=true, keyProperty="id", keyColumn="id")
    Integer save(TurntablePhone turntablePhone);


    @Select("select id,phone   from turntable_phone order by id")
    List<TurntablePhone> queryAll();

    @Select("select count(id) from turntable_phone")
    Integer countAll();

    @Select("select id   from turntable_phone where phone not in(select phone from turntable_record)")
    List<Long> queryByRemain();

    @Select("select id,phone   from turntable_phone where id=#{id}")
    TurntablePhone queryById(Long id);
}
